﻿using Awsc.DataAcquisitionSys.Api.Models;
using Awsc.DataAcquisitionSys.Core.DataAcquisition;
using Microsoft.AspNetCore.SignalR;


namespace Awsc.DataAcquisitionSys.Api.SingalRServices
{
    public class SensorDataHub : Hub
    {
        // 后端会持续向前端发送模拟的传感器数据
        public async Task ReceiveSensorData(List<SensorData> data)
        {
            // 向所有连接的客户端发送传感器数据
            await Clients.All.SendAsync("ReceiveSensorData", data);
        }
        public override Task OnConnectedAsync()
        {
            return base.OnConnectedAsync();
        }

    }
    public class SensorDataFrame
    {
        public DateTime Date { get; set; }
        public List<SensorData> Datas { get; set; } = new List<SensorData>();
    }

}
